#-*-coding:utf-8-*-
from django.conf.urls import url
from . import views
from rest_framework_jwt.views import obtain_jwt_token
from rest_framework import routers


urlpatterns = [
    #判断用户名是否已经注册
    url(r'^usernames/(?P<username>)\w{5,20}/count/$',views.UsernameCountView.as_view()),
    #判断手机号是否重复注册
    url(r'^mobiles/(?P<mobile>)1[3-9]\d{9}/count/$',views.MobileCountView.as_view()),
    #注册
    url(r'^users/$',views.UserView.as_view()),
    #JWT登录 url(r'正则','视图函数'）
    url(r'^authorizations/$',obtain_jwt_token),

    #个人中心用户基本信息
    url(r'^user/$', views.UserDetailView.as_view()),
    #添加，更新邮箱
    url(r'^email/$',views.EmailView.as_view()),

    # 邮箱激活
    # url(r'^emails/verification/$', views.VerifyEmailView.as_view()),
    # 用户浏览记录
    url(r'^browse_histories/$', views.UserBrowsingHistoryView.as_view()),









]

router = routers.DefaultRouter()
router.register(r'addresses', views.AddressViewSet, base_name='addresses')

urlpatterns += router.urls

# POST /addresses/ 新建  -> create
# PUT /addresses/<pk>/ 修改  -> update
# GET /addresses/  查询  -> list
# DELETE /addresses/<pk>/  删除 -> destroy
# PUT /addresses/<pk>/status/ 设置默认 -> status
# PUT /addresses/<pk>/title/  设置标题 -> title